package com.gxa.modules.sys.controller;

import com.gxa.common.utils.PageUtils;
import com.gxa.common.utils.Result;
import com.gxa.modules.pay.service.PayService;
import com.gxa.modules.sys.dto.ComboDto;
import com.gxa.modules.sys.dto.PayOrderDto;
import com.gxa.modules.sys.dto.RechargeDto;
import com.gxa.modules.sys.service.RechargeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;

@Api(tags = "充值管理接口")
@RestController
public class RechargeController {
    @Autowired
    private RechargeService rechargeService;
    @Autowired
    private PayService payService;
    @ApiOperation(value = "充值管理--查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "page",value ="当前是第几页",dataType ="int"),
            @ApiImplicitParam(paramType = "query",name = "limit",value ="每页显示多少条",dataType ="int"),
            @ApiImplicitParam(paramType = "query",name = "rechargeTime",value ="查询条件：充值时间",dataType ="Date"),
            @ApiImplicitParam(paramType = "query",name = "startTime",value ="查询条件：开始时间",dataType ="Date"),
            @ApiImplicitParam(paramType = "query",name = "endTime",value ="查询条件：结束时间",dataType ="Date"),
            @ApiImplicitParam(paramType = "query",name = "orderNum",value ="查询条件：支付订单编号",dataType ="int"),
            @ApiImplicitParam(paramType = "query",name = "stata",value ="查询条件：付款状态",dataType ="int"),
            @ApiImplicitParam(paramType = "query",name = "tel",value ="查询条件：手机号",dataType ="String"),
            @ApiImplicitParam(paramType = "query",name = "order",value ="升序asc，降序填desc",dataType ="String"),
            @ApiImplicitParam(paramType = "query",name = "sidx",value ="排序字段",dataType ="String"),

    })
    @GetMapping("/recharge/list")
    public Result<PageUtils> queryList(@RequestParam @ApiIgnore Map<String,Object> params){

        PageUtils pageUtils = this.rechargeService.queryByPage(params);

        return new Result<PageUtils>().ok(pageUtils);
    }


@ApiOperation("充值套餐查询接口")
@GetMapping("/recharge")
public Result queryAllDetail() {
     List<ComboDto> comboDtos = rechargeService.queryRecharge();
    return new Result<>().ok(comboDtos);

}









//    @ApiOperation("查询接口")
//    @GetMapping("/recharges")
//    public Result queryAllZong() {
//        List<PayOrderDto> payOrderDtos = payService.queryRecharge01();
//        return new Result<>().ok(payOrderDtos);
//
//    }
}

